//
//  SpaceTableViewCell.m
//  chatchatchat
//
//  Created by 小灰灰的pro on 16/3/25.
//  Copyright © 2016年 小灰灰. All rights reserved.
//

#import "SpaceTableViewCell.h"

@implementation SpaceTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initLayout];
    }
    return self;
}

- (void)initLayout{
    //用户头像
    self.userIconImageVeiw = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 40, 40)];
    self.userIconImageVeiw.image = [UIImage imageNamed:@"icon58"];
    [self.contentView addSubview:self.userIconImageVeiw];
    //用户名
    self.userNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 10, 100, 20)];
    self.userNameLabel.text = @"程序员";
    self.userNameLabel.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.userNameLabel];
    //正文
    self.contextLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 30, [UIScreen mainScreen].bounds.size.width - 70, 30)];
    self.contextLabel.text = @"我是一只快乐的程序员";
    self.contextLabel.numberOfLines = 0;
    self.contextLabel.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.contextLabel];
    //时间
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, self.contextLabel.frame.origin.y + self.contextLabel.frame.size.height + 10, 150, 20)];
    self.timeLabel.text = @"10分钟前";
    self.timeLabel.font = [UIFont systemFontOfSize:10];
    [self.contentView addSubview:self.timeLabel];
    //赞
    self.likeLabel = [[UILabel alloc] initWithFrame:CGRectMake(250, self.contextLabel.frame.origin.y + self.contextLabel.frame.size.height + 10, 30, 20)];
    self.likeLabel.text = @"赞:";
    self.likeLabel.font = [UIFont systemFontOfSize:10];
    [self.contentView addSubview:self.likeLabel];
    //点赞数
    self.like_countLabel = [[UILabel alloc] initWithFrame:CGRectMake(270, self.contextLabel.frame.origin.y + self.contextLabel.frame.size.height + 10, 30, 20)];
    self.like_countLabel.text = @"0";
    self.like_countLabel.font = [UIFont systemFontOfSize:10];
    [self.contentView addSubview:self.like_countLabel];
    //点赞
    self.likeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.likeButton.frame = CGRectMake(290, self.contextLabel.frame.origin.y + self.contextLabel.frame.size.height + 2, 15, 15);
    [self.likeButton setImage:[UIImage imageNamed:@"iconfont-dianzan"] forState:UIControlStateNormal];
    [self.likeButton setImage:[UIImage imageNamed:@"iconfont-dianzan-2"] forState:UIControlStateHighlighted];
    [self.contentView addSubview:self.likeButton];
    
}

@end
